import request from '@/config/axios'

// 奖品列 VO
export interface LuckyBoxVO {
  prizeId: number // 奖品id
  skuId: number  //商品sku_id
  sort: number // 排序
  type: number // 奖品类型
  prizeSpecs: string // 商品规格
  prizeName: string // 奖品名称
  probabilityWinning: number // 中奖概率百分比
}

// 奖品列 API
export const LuckyBoxApi = {
  // 查询奖品列分页
  getLuckyBoxPage: async (params: any) => {
    return await request.get({ url: `/promotion/lucky-box/page`, params })
  },

  // 查询奖品列详情
  getLuckyBox: async (id: number) => {
    return await request.get({ url: `/promotion/lucky-box/get?id=` + id })
  },

  // 新增奖品列
  createLuckyBox: async (data: LuckyBoxVO) => {
    return await request.post({ url: `/promotion/lucky-box/create`, data })
  },

  // 修改奖品列
  updateLuckyBox: async (data: LuckyBoxVO) => {
    return await request.put({ url: `/promotion/lucky-box/update`, data })
  },

  // 删除奖品列
  deleteLuckyBox: async (id: number) => {
    return await request.delete({ url: `/promotion/lucky-box/delete?id=` + id })
  },

  // 导出奖品列 Excel
  exportLuckyBox: async (params) => {
    return await request.download({ url: `/promotion/lucky-box/export-excel`, params })
  },
}
